home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / mint104s.zoo / mint.src / makefile < prev    next >
Makefile  |  1993-03-08  |  6KB  |  219 lines

  1. #
  2. # Makefile for MiNT using the GCC
  3. #
  4.  
  5. # if you're cross-compiling, define NATIVECC
  6. # to the host's C compiler, NATIVECFLAGS to
  7. # the appropriate flags for it, and NATIVELIBS
  8. # to appropriate libraries
  9. # NATIVECC = cc -DNO_STDLIB
  10. # NATIVECFLAGS = -g
  11. # NATIVELIBS =
  12.  
  13. NATIVECC = gcc
  14. NATIVECFLAGS = -O
  15. NATIVELIBS = -liio
  16.  
  17. #
  18. # depending on your version of bison/yacc, you may
  19. # need to change these names, e.g. to
  20. # YACC = yacc
  21. # YTABC = y.tab.c
  22. # YTABH = y.tab.h
  23.  
  24. YACC = bison -d
  25. YTABC = asm_tab.c
  26. YTABH = asm_tab.h
  27.  
  28. # here are defs for the cross compiler
  29. # MiNT must be compiled with 16 bit integers
  30.  
  31. CC = gcc
  32. AS = gcc
  33. MODEL = -mshort
  34. MODEL030 = -mshort -m68020
  35. LIBS = -liio16
  36.  
  37. # add -DMULTITOS for a MultiTOS kernel
  38. # add -DONLY030 for a version of MiNT that needs a 680x0, x>=3
  39.  
  40. DEFS = -DMULTITOS
  41. #DEFS030 = -DMULTITOS -DONLY030
  42. DEFS030 = -DONLY030
  43.  
  44. #
  45. # if you have an older version of gcc, it won't understand -G;
  46. # that won't hurt anything (it just controls the format of the
  47. # symbol table) so just delete the -G. Do *not* change it into
  48. # -g!!!
  49. #
  50. CFLAGS = -G -Wall -O2 -fomit-frame-pointer $(MODEL) $(DEFS)
  51. ASFLAGS = $(MODEL)
  52. CFLAGS030 = -G -Wall -O2 -fomit-frame-pointer $(MODEL030) $(DEFS030)
  53. ASFLAGS030 = $(MODEL030)
  54.  
  55. COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \
  56.     filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \
  57.     biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  58.     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o
  59.  
  60. COBJS030 = bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 dossig.o0 \
  61.     filesys.o0 main.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  62.     biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 \
  63.     unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o realloc.o0
  64.  
  65. CSRCS = bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c dossig.c \
  66.     filesys.c main.c mem.c proc.c signal.c timeout.c tty.c util.c \
  67.     biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
  68.     unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c
  69.  
  70. SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o
  71. SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0
  72.  
  73. OBJS = $(COBJS) $(SOBJS)
  74. OBJS030 = $(COBJS030) $(SOBJS030)
  75.  
  76. all: mint.prg mint030.prg
  77.  
  78. mint.prg: $(OBJS)
  79.     $(CC) $(CFLAGS) -o mint.prg $(OBJS) $(LIBS)
  80.     prgflags 7 7 mint.prg
  81.     strip mint.prg
  82.  
  83. mint030.prg: $(OBJS030)
  84.     $(CC) $(CFLAGS030) -o mint030.prg $(OBJS030) $(LIBS)
  85.     prgflags 7 7 mint030.prg
  86.     strip mint030.prg
  87.  
  88. $(SOBJS): proc.h
  89. $(COBJS): mint.h proc.h file.h
  90.  
  91. $(SOBJS030): proc.h
  92. $(COBJS030): mint.h proc.h file.h
  93.  
  94. main.o: version.h
  95. welcome.o: version.h
  96. bios.o: inline.h
  97.  
  98. memprot.o: memprot.c mint.h proc.h file.h
  99.     $(CC) $(CFLAGS) -m68020 -c memprot.c
  100.  
  101. main.o0: version.h
  102. welcome.o0: version.h
  103. bios.o0: inline.h
  104.  
  105. #
  106. # assembler source files are now handled in a radically different
  107. # fashion. We build a pre-processor program, asmtrans, that
  108. # takes the .spp files, merges them with an include file that
  109. # gives various offsets into structures of interest, and produces
  110. # the .s files as output. This has two major advantages:
  111. # (1) it lets us use the same source for both the Lattice and
  112. #     gcc assembler files (the translator will convert), and
  113. # (2) if we change the CONTEXT or PROC structures, we don't
  114. #     have to dig through the source code looking for
  115. #     magic numbers
  116.  
  117. # the asm translator program
  118. # Note that this must be compiled with the native CC of whatever
  119. # system you're using; see the definitions at the top of this
  120. # file.
  121.  
  122. ATRANSOBJ = asmtab.o trutil.o trans.o
  123. ATRANS = asmtrans.ttp
  124.  
  125. $(ATRANS): $(ATRANSOBJ)
  126.     $(NATIVECC) $(NATIVECFLAGS) -o $(ATRANS) $(ATRANSOBJ) \
  127.         $(NATIVELIBS)
  128.  
  129. asmtab.o: asmtab.c asmtrans.h
  130.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c asmtab.c
  131.  
  132. trutil.o: trutil.c asmtrans.h
  133.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trutil.c
  134.  
  135. trans.o: trans.c asmtrans.h
  136.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trans.c
  137.  
  138.  
  139. asmtab.c asmtab.h:    asm.y
  140.     $(YACC) asm.y
  141.     mv $(YTABC) asmtab.c
  142.     mv $(YTABH) asmtab.h
  143.  
  144. # the magic number include file is generated automagically
  145. # NOTE that of course, magic.i can only reliably be generated
  146. # on an Atari ST; if you're cross-compiling, you'll have
  147. # to edit magic.i by hand
  148. # for cross compilers; uncomment the following definitions
  149. # and comment out the other ones below
  150.  
  151. # for cross-compiling
  152.  
  153. # GENMAGICPRG=echo
  154. # magic.i: proc.h file.h genmagic.c
  155. #    echo "Warning: magic.i may be out of date"
  156.  
  157. #for native compiling
  158.  
  159. GENMAGICPRG=genmagic.ttp
  160.  
  161. $(GENMAGICPRG): genmagic.c proc.h file.h
  162.     $(CC) $(CFLAGS) -DGENMAGIC -o $(GENMAGICPRG) genmagic.c
  163.  
  164. magic.i: $(GENMAGICPRG)
  165.     $(GENMAGICPRG) $@
  166.  
  167. #
  168. # assembler source files
  169. #
  170. .SUFFIXES: .spp .o0
  171.  
  172. .spp.o:
  173.     $(ATRANS) $(DEFS) -gas -o $*.s $<
  174.     $(AS) $(ASFLAGS) -o $@ -c $*.s
  175.     $(RM) $*.s
  176. .spp.o0:
  177.     $(ATRANS) $(DEFS030) -gas -o $*.s $<
  178.     $(AS) $(ASFLAGS0) -o $@ -c $*.s
  179.     $(RM) $*.s
  180. .c.o0:
  181.     $(CC) $(CFLAGS030) -o $@ -c $<
  182.  
  183. context.o: context.spp magic.i $(ATRANS)
  184. intr.o: intr.spp magic.i $(ATRANS)
  185. syscall.o: syscall.spp magic.i $(ATRANS)
  186. quickzer.o: quickzer.spp $(ATRANS)
  187. quickmov.o: quickmov.spp $(ATRANS)
  188. cpu.o: cpu.spp $(ATRANS)
  189.  
  190. context.o0: context.spp magic.i $(ATRANS)
  191. intr.o0: intr.spp magic.i $(ATRANS)
  192. syscall.o0: syscall.spp magic.i $(ATRANS)
  193. quickzer.o0: quickzer.spp $(ATRANS)
  194. quickmov.o0: quickmov.spp $(ATRANS)
  195. cpu.o0: cpu.spp $(ATRANS)
  196.  
  197. #
  198. # mkptypes generates prototypes from C source code. If you don't have it,
  199. # you'll have to add/delete function prototypes by hand.
  200. # also: Sozobon users will have to edit proto.h by hand to change the
  201. #    #if defined(__STDC__) || defined(__cplusplus)
  202. # line into
  203. #    #if __STDC__
  204. #
  205. proto.h: $(CSRCS)
  206.     mkptypes $(CSRCS) >proto.h
  207.  
  208. #
  209. # macros for cleaning up
  210. #
  211. GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG)
  212. EXTRAS= asmtab.c asmtab.h mint.prg
  213.  
  214. clean:
  215.     $(RM) $(GENFILES)
  216.  
  217. realclean:
  218.     $(RM) $(GENFILES) $(EXTRAS)
  219.